home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 May: Tool Chest / Dev.CD May 98 TC.toast / Tool Chest / Development Kits / HyperCard Related / APDA HyperCard Toolkits / HyperCard Serial Toolkit 2.6 / Source Code / sendSPortDone.p < prev    next >
Encoding:
Text File  |  1995-02-07  |  1.5 KB  |  67 lines  |  [TEXT/MPS ]

  1. (*
  2.     sendSPortDone() -- Returns 'true' if any sending activity on the serial port is completed.
  3.  
  4.     To compile and link this file using Macintosh Programmer's Workshop,
  5.  
  6.         pascal -w sendSPortDone.p
  7.         link -m ENTRYPOINT -o HyperCommands -rt XFCN=7033 -sn Main=sendSPortDone ∂
  8.             sendSPortDone.p.o "{MPW}"Libraries:interface.o "{MPW}"Libraries:Libraries:HyperXLib.o
  9.  
  10.     © Copyright 1987,88,89 by Apple Computer, Inc.
  11.  
  12.     Initial coding 9/87 by Harry R. Chesley.
  13. *)
  14.  
  15. {$R-}
  16.  
  17. {$S sendSPortDone }     { Segment name must be the same as the command name. }
  18.  
  19. unit DummyUnit;
  20.  
  21. interface
  22.  
  23. uses MemTypes, QuickDraw, OSIntf, HyperXCmd;
  24.  
  25. procedure EntryPoint(paramPtr: XCmdPtr);
  26.     
  27. implementation
  28.  
  29. procedure sendSPortDone(paramPtr: XCmdPtr); forward;
  30.  
  31. procedure EntryPoint(paramPtr: XCmdPtr);
  32.  
  33.     begin
  34.         sendSPortDone(paramPtr);
  35.     end;
  36.  
  37. procedure sendSPortDone(paramPtr: XCmdPtr);
  38.  
  39.     var i: integer;
  40.  
  41.     procedure Fail(errMsg: Str255); { set theResult and quit }
  42.         begin
  43.             paramPtr^.returnValue := PasToZero(paramPtr,errMsg);
  44.             exit(sendSPortDone);
  45.         end;
  46.  
  47.     {$I SPortUtil.inc}
  48.  
  49.     begin
  50.         if paramPtr^.paramCount <> 0 then Fail('parameter count is not 0');
  51.  
  52.         SetUpSPortGlobals;
  53.         EnsureOpenPort;
  54.  
  55.         { Check if all asynchronous activity has finished. }
  56.         for i := 1 to MAXPARMBLKS do
  57.             if ThisSPort.parmBlks[i]^.ioResult > noErr then
  58.                 begin
  59.                     { If not, return false. }
  60.                     paramPtr^.returnValue := PasToZero(paramPtr,'false');
  61.                     exit(sendSPortDone);
  62.                 end;
  63.         { If yes, return true. }
  64.         paramPtr^.returnValue := PasToZero(paramPtr,'true')
  65.     end;
  66. end.
  67.